package com.btex.app.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.btex.app.R;
import com.btex.app.entity.MyOrderListInfo;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * @author zy zhangyi <zhangyi, 1104745049@QQ.com
 * @version v1.0
 * @project study1
 * @Description
 * @encoding UTF-8
 * @date 2018/8/20
 * @time 上午11:15
 * @修改记录 <pre>
 * 版本       修改人         修改时间         修改内容描述
 * --------------------------------------------------
 * <p>
 * --------------------------------------------------
 * </pre>
 */

public class MyOrderAllAdapter extends BaseQuickAdapter<MyOrderListInfo.DataBean, BaseViewHolder> {
    public MyOrderAllAdapter(@Nullable List<MyOrderListInfo.DataBean> data) {
        super(R.layout.otc_my_order_all_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyOrderListInfo.DataBean item) {

        TextView otc_fragment_my_order_tv_name = (TextView) helper.getView(R.id.otc_fragment_my_order_tv_name);
        TextView otc_fragment_my_order_tv_order = (TextView) helper.getView(R.id.otc_fragment_my_order_tv_order);
        TextView otc_fragment_my_order_tv_price = (TextView) helper.getView(R.id.otc_fragment_my_order_tv_price);
        TextView otc_fragment_my_order_tv_state = (TextView) helper.getView(R.id.otc_fragment_my_order_tv_state);
        TextView otc_fragment_my_order_tv_type = (TextView) helper.getView(R.id.otc_fragment_my_order_tv_type);
        TextView otc_fragment_my_order_tv_time = (TextView) helper.getView(R.id.otc_fragment_my_order_tv_time);


        String trade_status = item.getTrade_status();

//        if (trade_status.equals("0")) {
//
//            otc_fragment_my_order_tv_state.setText("未付款");
//            otc_fragment_my_order_tv_state.setTextColor(Color.parseColor("#ff6a19"));
//
//        } else if (trade_status.equals("1")) {
//
//            otc_fragment_my_order_tv_state.setText("已付款");
//            otc_fragment_my_order_tv_state.setTextColor(Color.parseColor("#39ae39"));
//
//
//        } else if (trade_status.equals("2")) {
//
//            otc_fragment_my_order_tv_state.setText("已完成");
//            otc_fragment_my_order_tv_state.setTextColor(Color.parseColor("#39ae39"));
//        } else if (trade_status.equals("-1")) {
//            otc_fragment_my_order_tv_state.setText("已取消");
//            otc_fragment_my_order_tv_state.setTextColor(Color.parseColor("#7c7c7c"));
//
//        } else if (trade_status.equals("-2")) {
//
//            otc_fragment_my_order_tv_state.setText("已锁定");
//            otc_fragment_my_order_tv_state.setTextColor(Color.parseColor("#7c7c7c"));
//
//        }


        String trade_type = item.getTrade_type();
        if (trade_type.equals("sell")) {
            otc_fragment_my_order_tv_type.setText("卖出");
            otc_fragment_my_order_tv_type.setBackgroundColor(Color.parseColor("#c91829"));
        } else {
            otc_fragment_my_order_tv_type.setText("买入");
            otc_fragment_my_order_tv_type.setBackgroundColor(Color.parseColor("#78aa21"));
        }

        otc_fragment_my_order_tv_name.setText(item.getPay_info().getUser_name());

        otc_fragment_my_order_tv_price.setText(item.getTotal());

        otc_fragment_my_order_tv_time.setText(item.getCtime());
        otc_fragment_my_order_tv_order.setText(item.getTrade_id());


    }
}
